//
//  CLEmoiconButton.swift
//  CLWeibo
//
//  Created by 陈亮 on 16/7/20.
//  Copyright © 2016年 陈亮. All rights reserved.
//

import UIKit

class CLEmoiconButton: UIButton {

    //表情模型
    var emoiconModel:CLEmoiconModel? {
        didSet{
            guard let model = emoiconModel else {
                return
            }
            //显示表情按钮
            self.hidden = false
            if model.type == "0" {
                self.setImage(UIImage(named: model.path!), forState: .Normal)
                self.setTitle(nil, forState: .Normal)
            }else {
                self.setTitle((model.code! as NSString).emoji(), forState: .Normal)
                self.setImage(nil, forState: .Normal)
            }
        }
    }

}
